import axios from 'axios';

const fileId = '7ryM2G71XRVwkQnkklWrbI';
const token = process.env.FIGMA_ACCESS_TOKEN;

console.log('🔍 测试Figma API访问...');
console.log('文件ID:', fileId);

try {
  const response = await axios.get(`https://api.figma.com/v1/files/${fileId}`, {
    headers: { 'X-Figma-Token': token }
  });
  
  console.log('✅ Figma API访问成功!');
  console.log('文件名:', response.data.name);
  console.log('页面数量:', response.data.document.children.length);
  
  // 显示页面信息
  response.data.document.children.forEach((page, index) => {
    console.log(`页面 ${index + 1}: ${page.name} (ID: ${page.id})`);
  });
  
} catch (error) {
  console.log('❌ API访问失败:', error.response?.status, error.response?.statusText);
  console.log('错误详情:', error.response?.data);
}
